#include "server_subwindow5.h"
#include "ui_server_subwindow5.h"


server_subwindow5::server_subwindow5(QWidget *parent, Qt::WFlags flags)
	: QWidget(parent, flags)
{
	ui = new Ui::server_subwindow5;
	ui->setupUi(this);

	//connect(ui.treeView,SIGNAL(clicked(QModelIndex)),this,SLOT(on_treeView_Clicked()));
	//	iterateOverItems();
}

server_subwindow5::~server_subwindow5()
{
	delete ui;
}


void server_subwindow5::setupValues()
{
    ui->lineEdit_1->setText( (QString)m_device_item->id() );
    ui->lineEdit_2->setText( m_device_item->name() );
    ui->lineEdit_3->setText( QString::number( m_device_item->device_type()->id() ) );

    foreach(nr_device_type* device_type, m_device_type_manager->device_types())
    {
        if ( device_type->id() == m_device_item->device_type()->id() )
        {
            ui->lineEdit_4->setText( QString::number( device_type->id() ) );
            ui->lineEdit_5->setText( device_type->name() );
            ui->lineEdit_6->setText( device_type->text() );
            ui->lineEdit_7->setText( device_type->category() );
            ui->lineEdit_8->setText( device_type->description() );
            ui->lineEdit_9->setText( device_type->module() );
        }
    }

    foreach( nr_device_property* device_property, m_device_item->properties() )
    {
        switch( device_property->id() )
        {
        case 1:
            foreach(nr_device_property* device_property2, device_property->children())
            {
                switch ( device_property2->id() )
                {
                case 1:
                    //QString::number( device_property->id() );
                    ui->lineEdit_10->setText( device_property2->value().toString() );
                    break;
                case 2:
                    ui->lineEdit_11->setText( device_property2->value().toString() );
                    break;
                case 3:
                    ui->lineEdit_12->setText( device_property2->value().toString() );
                    break;
                }
            }
            break;
        case 2:
            ui->lineEdit_13->setText( device_property->value().toString() );
            break;
        case 3:
            ui->lineEdit_14->setText( device_property->value().toString() );
            break;
        case 4:
            ui->lineEdit_15->setText( device_property->value().toString() );
            break;
        case 5:
            ui->lineEdit_16->setText( device_property->value().toString() );
            break;
        case 6:
            ui->lineEdit_17->setText( device_property->value().toString() );
            break;
        }

    }
}
